﻿using AnesSystem.Controls;
using AnesSystem.Controls.Pacu.DigLog;
using AnesSystem.Models;
using AnesSystem.Services;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem.ViewModels.Pacu.DigLog
{
   public class AnesMaZuiOptDoctorViewModel: BaseViewModel<AnesMaZuiOptDoctorViewModel>
    {


        private List<AccountModel> _accountAnesModelList = new List<AccountModel>();


        private String _disAnesDoctorName = "";

        private string _zmysAccount = "";
        private string _fmysAccount = "";


        public AnesMaZuiOptDoctorViewModel()
        {

        }
        public string DisAnesDoctorName
        {
            get
            {

                return _disAnesDoctorName;
            }

            set
            {
                _disAnesDoctorName = value;
                RaisePropertyChanged("DisAnesDoctorName");
            }
        }

        public string ZmysAccount
        {
            get
            {
                return _zmysAccount;
            }

            set
            {
                _zmysAccount = value;
                RaisePropertyChanged("ZmysAccount");
            }
        }

        public string FmysAccount
        {
            get
            {
                return _fmysAccount;
            }

            set
            {
                _fmysAccount = value;
                RaisePropertyChanged("FmysAccount");
            }
        }

        private void ConvertAnesDoctor()
        {
            ZmysAccount = DataManager.Instance.GetAccountNameByID(PatientLink.Pacu.Mzys1) +
                (PatientLink.Pacu.Mzys1Role == null || "".Equals(PatientLink.Pacu.Mzys1Role) ? "" : "(" + PatientLink.Pacu.Mzys1Role + ")");
            FmysAccount = DataManager.Instance.GetAccountNameByID(PatientLink.Pacu.Mzys2) +
                (PatientLink.Pacu.Mzys2Role == null || "".Equals(PatientLink.Pacu.Mzys2Role) ? "" : "(" + PatientLink.Pacu.Mzys2Role + ")");
           
        }
        //麻醉医生控件
        public void AnesDoctorTanChu()
        {

            PacuDoctorOptCtrl ado = new PacuDoctorOptCtrl();
            DrugAndEventWindow.Instance.CusContent = ado;
            DrugAndEventWindow.Instance.Width = 450;
            DrugAndEventWindow.Instance.Height = 350;
            DrugAndEventWindow.Instance.Title = "复苏麻醉医生";
            DrugAndEventWindow.Instance.ShowDialog();
            DoctorPacuOptViewModel vm = ado.DataContext as DoctorPacuOptViewModel;
            ado.KeepAccountModel += (newAccountModelList) =>
            {
                ZmysAccount = DataManager.Instance.GetAccountNameByID(vm.ZmysAccount) + (vm.ZmysRole == null || "".Equals(vm.ZmysRole) ? "" : "(" + vm.ZmysRole + ")");
                FmysAccount = DataManager.Instance.GetAccountNameByID(vm.Fmys1Account) + (vm.Fmys1Role == null || "".Equals(vm.Fmys1Role) ? "" : "(" + vm.Fmys1Role + ")");
            };
        }

        public void Load_Page()
        {
            ConvertAnesDoctor();

        }

    }
}
